<template>
<view>
	<view class="header">盘点表</view>
	<view class="table">
		<table border="0" width="95%" cellspacing="0" cellpadding="0">
			<tr v-for="(item,index) in list" :key="index" @click="jump('./info',item.json)">
				<th>盘点时间</th>
				<th>{{item.addtime}}</th>
				<th>查看</th>
			</tr>
		</table>
	</view>
	<button class="buttonClass" @click="add">确定</button>
</view>
</template>
<script>
import request from '@/util/request.js'
export default {
	data() {
		return {
			//oaRole 1:店长2:员工3:商户
			list:[],
			page:1,
			pageShow:true
		}
	},
	onLoad:function(e){
		uni.showLoading({
		    title: '加载中'  
		});
		this.getList();
	},
	methods: {
		getList:function(){
			var data = {
				oa_id:uni.getStorageSync('oa_id'),
				page:this.page,
			}
			var that = this
			request({
				url: 'manage/goods/getSheet',
				method: 'get',
				data:data,
				success: (res) => {
					uni.hideLoading();
					if(res.data.code == 1){
						if(res.data.data.last_page <= that.page){
							that.pageShow = false
						}
						if(that.page == 1){
							that.list = res.data.data.data
						}else{
							var list = that.list
							that.list = list.concat(res.data.data.data)
						}
					}
				},
			})
		},
		onReachBottom: function(){
			if(this.pageShow){
				 //当前不是最后一页可加载
				 this.page = this.page + 1
				 uni.showLoading()
				 this.getList();
			}
		},
		jump:function(url,item){
			uni.navigateTo({
			  url:url+'?item='+JSON.stringify(item)
			})
		}
	}
}
</script>
<style>
.header{
    width:100%;
    height:80rpx;
    line-height: 80rpx;
    text-align: center;
    background:#00b300;
    color:#fff;
}
.table{
	width:100%;
	padding:10rpx 20rpx 120rpx 20rpx;
}
table{
	margin-top:30rpx;
}
td{
	border:1rpx solid #C8C7CC;
	text-align: center;
	height:70rpx;
	line-height:70rpx;
}
th{
	border:1rpx solid #C8C7CC;
	text-align: center;
	height:70rpx;
	line-height:70rpx;
}
.td1{
	width:40%;
}
.td2{
	width:20%;
}

/* input{
	border-bottom: 1rpx dashed #000000;
} */
</style>